const initialState = {
    list: []
};

export const actionsTypes = {
    GET_MILESTONE: "GET_MILESTONE",
    RES_MILESTONE: "RES_MILESTONE",
    SET_MILESTONE: "SET_MILESTONE",
};

export const actions = {
    set_milestone: function (data, project_id) {
        return {
            type: actionsTypes.SET_MILESTONE,
            data,
            project_id
        }
    },
    get_milestone: function (project_id) {
        return {
            type: actionsTypes.GET_MILESTONE,
            project_id
        }
    }
}

export function reducer(state=initialState, action) {
    switch (action.type) {
        case actionsTypes.RES_MILESTONE:
            return {
                ...state,
                list: action.data
            }
        default:
            return state
    }
}